<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<title>华阳物流</title>
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css"/>	
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resources/css/public.css"/>
		
	</head>
	<body class="huayang">
		<header class="clearfix">
			<a class="navbar-brand d-inline logo2" href="#"><img src="<%=request.getContextPath()%>/resources/img/logo.png"></a>
			<a class="navbar-brand d-inline logo3" href="#"><img src="<%=request.getContextPath()%>/resources/img/1.png"></a>
		</header>
		<div class="clearfix">
			
		</div>
        <nav class="navbar navbar-expand-lg navbar-light bg-light">
            <!--<a class="navbar-brand" href="#">Navbar</a>-->
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
           	
              <ul class="navbar-nav mr-auto">
              	<div class="container">       	
            	<div class="row clearfix">
              	<li class="nav-item active col-xs-6">
                  <a class="nav-link nav1" href="${ctx }/department/chengCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                  <a class="nav-link nav2" href="${ctx }/department/mianCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                 <li id="mz" class="nav-item active col-xs-6">
                  <a class="nav-link nav6" href="${ctx }/department/mzCity?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                  <a class="nav-link nav3" href="${ctx }/after/showAfter?pageNow=1&&deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
                <li class="nav-item active col-xs-6">
                 <a class="nav-link nav4" href="${ctx }/accountlist/selectAccountList?deptid=${deptid}&&rolename=${role.rolename}&deptname=&zhiling=&chexing=&xingming=&jiesuan=&jiashiyuanjs=&fatime1=&fatime2="><span></span></a>
                </li>
                <li class="nav-item active col-xs-6 current">
                  <a class="nav-link nav5" href="${ctx }/back/guanli?deptid=${deptid}&&rolename=${role.rolename}"><span></span></a>
                </li>
               </div>
              </div>
              </ul>
            <div class="clearfix"></div>
            <ul class="nav justify-content-center fixed-top align-middle clearfix ">
			  <li class="nav-item">
                <img class="user-img rounded-circle" src="<%=request.getContextPath()%>/resources/img/raw_1514434504.jpg"/>  
              </li>
              <li class="nav-item user-info">
                <span>${user.uname}</span>    
                <span>${role.rolename}</span> 
              </li>
              <li class="nav-item pwd-change">
                <a class="nav-link active align-text-bottom" href="${ctx }/tuser/pwdjsp?deptid=${deptid}">修改密码</a>                
              </li>
              <li class="nav-item exit"> 
              	<a href="${ctx }/back/userLoginOut" onclick="return confirm('您确定要退出系统吗？');" class="nav-link active"><span class="px-3">
					<img src="<%=request.getContextPath()%>/resources/img/exit.png"></span>退出</a>     
              </li>
            </ul>
          </div>       
        </nav>	
        <div class="container-fluid content">
        	<div class="row">
        		<div class="page_position d-none d-sm-block">
        			<!--位置-->
        			<!-- <div class="container-fluid pl-5">
        				<div class="row py-3">
        					<a href="#">绵阳</a>>><a href="#">新增售后</a>
        				</div>
        			</div> -->
        		</div>
        			<div class="container-fluid pl-xl-5 pt-xl-5 p-0">
        				<div class="row pt-4 col-12 col-sm-12 col-lg-9 col-xl-10 p-0">
        				   <div class="container" id="contet-box">
        				   	<!--运单登记-->
        				   	<div class="row clearfix">
		                    <div class="container_form ">
		                	<form action="${ctx }/cars/addCars" id="list" name="list" method="post" role="form" onsubmit="return carsTest()" class="col-center-block">
			                	<div class="col-lg-6 form-group input-group-four">
			                	<p class="text-left">编辑车辆</p>
			                	<input type="hidden" name="cid" value="${cars.cid }">
			                	<div class="input-group">
								    <div class="input-group-addon">始发地：</div>
								    <input type="text" name="ccommence" value="${cars.ccommence }" id="ccommence" class="form-control">
							    </div>
				                <div class="input-group">
								    <div class="input-group-addon">目的地：</div>
								    <input type="text" name="cbourn" value="${cars.cbourn }" id="cbourn" class="form-control">
							    </div>
				                <div class="input-group">
								    <div class="input-group-addon">车型：</div>
								    <input type="text" name="cmileage" value="${cars.cmileage }" id="cmileage" class="form-control">
							    </div>
				                
							    <div class="input-group">
								    <div class="input-group-addon">驱数：</div>
								    <input type="text" name="cactuate"  value="${cars.cactuate }"  id="cactuate"  class="form-control">
							    </div>
							    <div class="input-group">
								    <div class="input-group-addon">厂家结算：</div>
								    <input type="text" name="cexpense" value="${cars.cexpense }" id="cexpense" onkeyup="CHANG_CheckDecimal(this)" class="form-control">
							    </div>  
							    <div class="input-group">
								    <div class="input-group-addon">驾驶员结算：</div>
								    <input type="text" name="cbrand" value="${cars.cbrand }" id="cbrand" onkeyup="JIA_CheckDecimal(this)" class="form-control">
							    </div>
							   <%--  <c:if test="${cars != null }"> --%>
								     <div class="form-group clearfix">
					                     <label class="radio-inline radio_class">
	                                                                               部门：
	                                     </label>
	                                  <input type="hidden" id="dName" value="${cars.cdeptname}">
	                                     <div class="radio_content clearfix ">     
						                          <label  class="radio-inline">
	                                      			 <input type="radio" name="cdeptname" id="deptname1" value="成都" > 成都
	                                   			  </label>
	                                   			  <label  class="radio-inline">
	                                      			 <input type="radio" name="cdeptname" id="deptname2" value="绵阳" > 绵阳
	                                   			  </label>
	                                     </div>
					                </div>
				                </div>
				                <div class="clearfix"></div>
				                <div class="form-group detail-button">
					                <div class="float-left">
						               <button type="submit" class="btn btn-default">提交</button>
						            </div>
                                    <div class="float-right">
                                       <button type="button" class="btn btn-default" onClick="history.back()">取消</button>
                                    </div>
				                </div>
				                
			                </form>
			                
		                </div>          
		            </div>
        				   	<!--运单登记-->
        					</div>
        				</div>       				
        			</div>
        		</div>
        	</div> 
		<script src="<%=request.getContextPath()%>/resources/js/jquery.slim.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="<%=request.getContextPath()%>/resources/js/js.js" type="text/javascript" charset="utf-8"></script>
        	<!--推送消息-->
        	
        		<jsp:include page="munetab.jsp" />
        	
		
	</body>
	<script type="text/javascript">
		
		var dName = document.getElementById("dName").value; 
		
		var deptname1 = document.getElementById("deptname1").value;
		
		var deptname2 = document.getElementById("deptname2").value;
		
		if(deptname1==dName){ 
		    $("#deptname1").attr("checked",true);  
		}else if(deptname2==dName){  
		    $("#deptname2").attr("checked",true);  
		}
		
	</script>
	<script type="text/javascript">
		function CHANG_CheckDecimal(cexpense){
		var cexpense = document.getElementById("cexpense").value;
		if (!/^\d+\.?\d{0,2}$/.test(cexpense)) {
			    	alert("请输入厂家结算正确金额!");
			    	return false;
			    }
		
		}
		function JIA_CheckDecimal(cexpense){
		var cbrand = document.getElementById("cbrand").value;
		if (!/^\d+\.?\d{0,2}$/.test(cbrand)) {
			    	alert("请输入驾驶员结算正确金额!");
			    	return false;
			    }
		
		}
	
	
		function carsTest(){
			var ccommence = document.getElementById("ccommence").value;
			var cbourn = document.getElementById("cbourn").value;
			var cmileage = document.getElementById("cmileage").value;
			var cactuate = document.getElementById("cactuate").value;
			var cexpense = document.getElementById("cexpense").value;
			var cbrand = document.getElementById("cbrand").value;
		
			
			if(ccommence==null||ccommence==""||ccommence==undefined){
				alert("请输入始发地");
				return false;
			}
			if(cbourn==null||cbourn==""||cbourn==undefined){
				alert("请输入目的地");
				return false;
			}
			if(cmileage==null||cmileage==""||cmileage==undefined){
				alert("请输入车型");
				return false;
			}
			if(cactuate==null||cactuate==""||cactuate==undefined){
				alert("请输入驱数");
				return false;
			}
			if(cexpense==null||cexpense==""||cexpense==undefined){
				alert("请输入厂家结算金额");
				return false;
			}
			if (!/^\d+\.?\d{0,2}$/.test(cexpense)) {
			    	alert("请输入厂家结算正确金额!");
			    	return false;
			    }
			if(cbrand==null||cbrand==""||cbrand==undefined){
				alert("请输入驾驶员结算金额");
				return false;
			}
			if (!/^\d+\.?\d{0,2}$/.test(cbrand)) {
			    	alert("请输入驾驶员结算正确金额!");
			    	return false;
			    }
			
		 var flag = false; 
			if((document.getElementById("deptname1").checked == true) || (document.getElementById("deptname2").checked == true)){  
			        flag = true;  
			      } 
			
			if (flag == false){  
			    alert("对不起，请选择所属部门"); 
			    return false;  
			}  
		
		
			
		}
	</script>
	<script type="text/javascript"> 
		   window.onload=function(){ 
				var action ='<%=request.getAttribute("result")%>';
				if(action.length!==4)
				{
						alert(action);
				}
			} 
		</script>
</html>
